package com.fairytask.items
{
	import com.fairytask.utils.Vec2D;
	
	import starling.display.Sprite;
	
	public class Avatar extends Sprite
	{
		public var acc:Number=0;
		
		protected var _forward:Boolean=false;
		
		public var angAcc:Number=0;
		
		public var point:Boolean=true;
		
		public var vel:Number=0;
		
		public var angVel:Number=0;
		
		protected var _right:Boolean=false;
		
		protected var _left:Boolean=false;
		
		public var ov:Vec2D;
		
		public var friction:Number=1;
		
		public function Avatar()
		{
			this.ov = new Vec2D();
			super();
			return;
		}
		
		public function clearFlags():void
		{
			this._forward = false;
			this._left = false;
			this._right = false;
			return;
		}
		
		public function forward():void
		{
			this._forward = true;
			return;
		}
		
		public function get posV():Vec2D
		{
			return new Vec2D(x, y);
		}
		
		public function left():void
		{
			this._left = true;
			return;
		}
		
		public function update(arg1:Number):void
		{
			this.ov.angle = this.ov.angle + this.angVel * arg1;
			rotation = this.ov.angle;
			this.vel = this.vel + this.acc * arg1;
			var loc1:*=this.ov.mulNum(this.vel);
			this.x = this.x + loc1.x * arg1;
			this.y = this.y + loc1.y * arg1;
			return;
		}
		
		public function pointAt(arg1:Number, arg2:Number):void
		{
			var loc1:*=this.posV;
			var loc2:*=new Vec2D(arg1, arg2);
			var loc3:*;
			rotation = loc3 = loc2.subVec(loc1).angle;
			this.ov.angle = loc3;
			return;
		}
		
		public function right():void
		{
			this._right = true;
			return;
		}
	}
}